package com.framework.service.config.initQuartz;

import com.framework.service.timedTask.impl.JobHandlerInvoker;
import org.quartz.CronScheduleBuilder;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * @author 龘鵺
 * @version 1.0
 * @className com.framework.service.config.initQuartz
 * @description 1
 * @datetime 2025-04-25 10:06:41
 */
//@Configuration
//@EnableScheduling
public class QuartzAutoConfig {

//    @Bean
//    public JobDetail dataCleanupJobDetail() {
//        return JobBuilder.newJob(JobHandlerInvoker.class)
//                .withIdentity("dataCleanupJob", "maintenance")
//                .usingJobData("daysToKeep", 30)
//                .usingJobData("dataType", "logs")
//                .storeDurably()
//                .build();
//    }
//
//    @Bean
//    public Trigger dataCleanupTrigger() {
//        // 创建CronScheduleBuilder
//        CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule("0 0 1 * * ?");
//
//        // 配置失败重试策略
//        scheduleBuilder.withMisfireHandlingInstructionFireAndProceed();
//
//        return TriggerBuilder.newTrigger()
//                .forJob(dataCleanupJobDetail())
//                .withIdentity("dataCleanupTrigger", "maintenance")
//                .withDescription("每天凌晨1点执行日志清理")
//                .withSchedule(scheduleBuilder)
//                .build();
//    }

}
